//变量的解构赋值


let [x = 1, y = x] = [];     // x=1; y=1
let [x = 1, y = x] = [2];    // x=2; y=2
let [x = 1, y = x] = [1, 2]; // x=1; y=2
let [x = y, y = 1] = [];     // ReferenceError


//如果变量名与属性名不一致，必须写成下面这样
var { foo: baz } = { foo: "aaa", bar: "bbb" };
baz // "aaa"


//只有line是变量，loc和start都是模式，不会被赋值
var node = {
    loc: {
        start: {
            line: 1,
            column: 5
        }
    }
};
var { loc: { start: { line }} } = node;
line // 1
loc  // error: loc is undefined
start // error: start is undefined